package com.example.binlog_connector_test.mysqllistener;


import org.springframework.context.ApplicationEvent;

import java.io.Serializable;
import java.util.List;
public class DbDataChangeEvent extends ApplicationEvent {


    /**
     * 表名称
     */
    private String tableName;

    /**
     * 主键id
     */
    private Long id;

    /**
     * 事件类型
     */
    private ChangeEventTypeEnum changeEventTypeEnum;

    /**
     * 旧数据
     */
    List<Serializable> oldData;

    /**
     * 新数据
     */
    List<Serializable> newData;

    /**
     * Create a new ApplicationEvent.
     *
     * @param source the object on which the event initially occurred (never {@code null})
     */
    public DbDataChangeEvent(Object source) {
        super(source);
    }

    public ChangeEventTypeEnum getChangeEventType(){
        return changeEventTypeEnum;
    }
    public Long getId(){
        return id;
    }
    public String getTableName(){
        return tableName;
    }

    public void setTableName(String tableName){
        this.tableName=tableName;
    }
    public void setId(Long id){
        this.id=id;
    }
    public void setChangeEventTypeEnum(ChangeEventTypeEnum changeEventTypeEnum){
        this.changeEventTypeEnum=changeEventTypeEnum;
    }

    public ChangeEventTypeEnum getChangeEventTypeEnum() {
        return changeEventTypeEnum;
    }

    public List<Serializable> getOldData() {
        return oldData;
    }

    public void setOldData(List<Serializable> oldData) {
        this.oldData = oldData;
    }

    public List<Serializable> getNewData() {
        return newData;
    }

    public void setNewData(List<Serializable> newData) {
        this.newData = newData;
    }
}
